"""
__author__ = 'berlinyoung'
@File   :handle_token.py
@Date   :2022/6/7 22:13
-*- coding: utf-8 -*-
"""
import requests


class Token:
    # 加入了staticmethod 装饰器就是静态方法
    # 在调用时，可以直接调用，不需要初始化类
    @staticmethod
    def get_token():
        corpid = "wwe7d44f4db2880615"
        corpsecret = "VQNnxFdQF8hAJEodXJh4sgSXlj-1w21wUz_kJpBW0sk"
        url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={corpsecret}"
        # requests.get 代表发送get请求
        r = requests.get(url)
        # r.text 代表取原生值
        print(r.text)
        access_token = r.json()["access_token"]
        return access_token